<script setup lang="ts">
import { reactive } from 'vue';
import {getNewsListData} from "@/api/news";
let initData = reactive([]);
function getInitData(){
  getNewsListData({config:{showLoading:false}}).then((res:any)=>{
    if(res.data&&res.data.length>0){
      initData.push(...res.data);
    }
  });
}
getInitData();
</script>
<template>
  <div class="news-page">
    <h2>论坛新闻</h2>
    <ul>
      <li v-for="item in initData" :key="item.id"><router-link :to="`/News/NewsDetail/${item.id}`">{{item.title}}</router-link></li>
    </ul>
  </div>
</template>
<script lang="ts">
export default {
  name: 'NewsIndex'
}
</script>
<style>
</style>